{load header}
<!--/H-->

    <!-- 内容区 -->
    <div id="main-content">
        <div id="top-alert" class="fixed alert alert-error" style="display: none;">
            <button class="close fixed" style="margin-top: 4px;">&times;</button>
            <div class="alert-content">这是内容</div>
        </div>
        <div id="main" class="main">
        <!-- nav --><!-- nav -->
            
	<!-- 标题栏 -->
	<div class="main-title">
		<h2>授权给管理组：【{$item['group_name']}】</h2>
	</div>
	
	
	<!-- 数据列表 -->
    <div class="data-table table-striped">
		<form action="" enctype="application/x-www-form-urlencoded" method="POST" class="form-horizontal auth-form">
					<!--{loop $premeun $k1 $val}-->
					<dl class="checkmod">
						<dt class="hd">
							<label class="checkbox"><input <!--{if (in_array($val['url'],$item['access']))}-->checked<!--{/if}--> class="auth_rules rules_all" type="checkbox" name="rules[]" value="{$val['url']}">{$val['title']}</label>
						</dt>
						<dd class="bd">
							
							<div class="rule_check">
									<div>
										<!--{loop $premeun[$k1]['children'] $v}-->
										<label class="checkbox" ><input <!--{if (in_array($val['url'].'_'.$v['url'],$item['access']))}-->checked<!--{/if}--> class="auth_rules rules_row" type="checkbox" name="rules[]" value="{$val['url']}_{$v['url']}"/>{$v['title']}</label>
										<!--{/loop}-->
									</div>
									<!----
									<span class="divsion">&nbsp;</span>
									<span class="child_row">
										
										<label class="checkbox" ><input class="auth_rules" type="checkbox" name="rules[]" value="7"/>新增</label>
										
									</span>
									---->
							</div>
							
						</dd>
					</dl>
					<!--{/loop}-->
			        <input type="hidden" name="id" value="{$item['id']}" />
                                <input type="hidden" name="name" value="{$item['group_name']}" />
                    <button type="submit" class="btn submit-btn ajax-post" target-form="auth-form">确 定</button>
                    <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
			    </form>
		
	</div>

<script type="text/javascript" src="{eval echo base_url()}static/qtip/jquery.qtip.min.js"></script>
<link rel="stylesheet" type="text/css" href="{eval echo base_url()}static/qtip/jquery.qtip.min.css" media="all">
<script type="text/javascript" charset="utf-8">
    +function($){
        var rules = [{$item['accredit']}];
        $('.auth_rules').each(function(){
            if( $.inArray( parseInt(this.value,10),rules )>-1 ){
                $(this).prop('checked',true);
            }
            if(this.value==''){
                $(this).closest('span').remove();
            }
        });

        //全选节点
        $('.rules_all').on('change',function(){
            $(this).closest('dl').find('dd').find('input').prop('checked',this.checked);
        });
        $('.rules_row').on('change',function(){
            $(this).closest('.rule_check').find('.child_row').find('input').prop('checked',this.checked);
        });

        $('.checkbox').each(function(){
            $(this).qtip({
                content: {
                    text: $(this).attr('title'),
                    title: $(this).text()
                },
                position: {
                    my: 'bottom center',
                    at: 'top center',
                    target: $(this)
                },
                style: {
                    classes: 'qtip-dark',
                    tip: {
                        corner: true,
                        mimic: false,
                        width: 10,
                        height: 10
                    }
                }
            });
        });

        
    }(jQuery);
</script>

<!--F-->{load footer}